<?php
// 本类由系统自动生成，仅供测试用途
class CommonAction extends Action{
    public function _initialize(){
        header("Content-Type:text/html; charset=utf-8");
		$webname = C('CMSNAME').C('Version');
		$_Config = include DATA_PATH.'~config.php';
		$this->checkUser();
		$this->head();
		$_SESSION['GroupName'] = '管理员';
		$this->assign('SESSION',$_SESSION);
		$this->assign('webname',$webname);
		$this->assign('copyright','版权所有 &copy; 墨龙网络科技');
    }
	
	//判断管理员是否登入，如果没有登入跳入登入页面
	protected function checkUser() {
		if(!isset($_SESSION['AdminName']) || !isset($_SESSION['AdminId'])) {
			$this->assign('jumpUrl',U('Public/login'));
			$this->error('没有登录，请重新登入！');
		}
	}
	
	public function head(){
		$mune = array(		     
			 array(
			     'id' => 'AdminIndex',
				 'name' => '后台首页',
				 'url' => U('Common/welcome'),
				 'display' => 'black',
				 'child' => array(
				     array('name' => '后台首页','ico' => 'nav','url' => U('Common/welcome')),
					 array('name' => '更新缓存','ico' => 'nav','url' => U('System/updata')),
					 array('name' => '系统日志','ico' => 'nav','url' => U('System/sys_log')),
					 )
			),	     
			 array(
			     'id' => 'System',
				 'name' => '系统设置',
				 'url' => U('System/config_sys'),
				 'display' => 'none',
				 'child' => array(
				     array('name' => '系统配置','ico' => 'nav','url' => U('System/config_sys')),
				     array('name' => '会员配置','ico' => 'nav','url' => U('System/user_sys')),
				     array('name' => '邮件协议','ico' => 'nav','url' => U('System/email_sys')),
				     array('name' => '上传配置','ico' => 'nav','url' => U('System/upload_sys')),
				     array('name' => '添加参数','ico' => 'nav','url' => U('System/add_sys')),
					 )
			),
			 array(
			     'id' => 'Module',
				 'name' => '模型管理',
				 'url' => U('Module/mod_list'),
				 'display' => 'none',
				 'child' => array(
				     array('name' => '模型列表','ico' => 'nav','url' => U('Module/mod_list')),
					 array('name' => '模型添加','ico' => 'nav','url' => U('Module/mod_add')),
				     array('name' => '字段管理','ico' => 'nav','url' => U('Module/field_list')),
					 array('name' => '添加字段','ico' => 'nav','url' => U('Module/field_add')),
					 )
			),
			 array(
			     'id' => 'Category',
				 'name' => '栏目管理',
				 'url' => U('Category/cat_list'),
				 'display' => 'none',
				 'child' => array(
				     array('name' => '栏目列表','ico' => 'nav','url' => U('Category/cat_list')),
					 array('name' => '栏目添加','ico' => 'nav','url' => U('Category/cat_add')),
					 )
			),
			 array(
			     'id' => 'Content',
				 'name' => '内容管理',
				 'url' => U('Content/article_list'),
				 'display' => 'none',
				 'child' => array(
				     array('name' => '文章管理','ico' => 'nav','url' => U('Content/article_list'),'child'=>array(array('name' => '添加','url' => U('Content/article_add')))),
					 array('name' => '下载管理','ico' => 'nav','url' => U('Content/down_list'),'child'=>array(array('name' => '添加','url' => U('Content/down_add')))),
					 array('name' => '图片管理','ico' => 'nav','url' => U('Content/photo_list'),'child'=>array(array('name' => '添加','url' => U('Content/photo_add')))),
					 )
			),
			 array(
			     'id' => 'User',
				 'name' => '用户系统',
				 'url' => U('User/admin_list'),
				 'display' => 'none',
				 'child' => array(
				     array('name' => '管理员列表','ico' => 'nav','url' => U('User/admin_list'),'child'=>array(array('name' => '添加','url' => U('User/admin_add')))),
				     array('name' => '会员列表','ico' => 'nav','url' => U('User/user_list'),'child'=>array(array('name' => '添加','url' => U('User/user_add')))),
				     array('name' => '会员组列表','ico' => 'nav','url' => U('User/group_list'),'child'=>array(array('name' => '添加','url' => U('User/group_add')))),
					 )
			),
			 array(
			     'id' => 'Plus',
				 'name' => '插件管理',
				 'url' => U('Plus/vote_list'),
				 'display' => 'none',
				 'child' => array(
				     array('name' => '投票系统','ico' => 'nav','url' => U('Plus/vote_list'),'child'=>array(array('name' => '添加','url' => U('Plus/vote_add')))),
				     array('name' => '广告管理','ico' => 'nav','url' => U('Plus/ads_list'),'child'=>array(array('name' => '添加','url' => U('Plus/ads_add')))),
					 array('name' => '留言系统','ico' => 'nav','url' => U('Plus/guestbook')),
					 )
			),
		);
		$this->assign('mune',$mune);
	}
	
	//后台首页欢迎页面
	public function welcome(){
        $info = array(
            '操作系统'=>PHP_OS,
            '运行环境'=>$_SERVER["SERVER_SOFTWARE"],
            'PHP运行方式'=>php_sapi_name(),
			'CMS系统名称' => '墨龙网络网站管理系统',
			'CMS系统版本' => C('Version'),
            'ThinkPHP版本'=>THINK_VERSION.' [ <a href="http://thinkphp.cn" target="_blank">查看最新版本</a> ]',
            '上传附件限制'=>ini_get('upload_max_filesize'),
            '执行时间限制'=>ini_get('max_execution_time').'秒',
            '服务器时间'=>date("Y年n月j日 H:i:s"),
            '北京时间'=>gmdate("Y年n月j日 H:i:s",time()+8*3600),
            '服务器域名/IP'=>$_SERVER['SERVER_NAME'].' [ '.gethostbyname($_SERVER['SERVER_NAME']).' ]',
            '剩余空间'=>round((disk_free_space(".")/(1024*1024)),2).'M',
            'register_globals'=>get_cfg_var("register_globals")=="1" ? "ON" : "OFF",
            'magic_quotes_gpc'=>(1===get_magic_quotes_gpc())?'YES':'NO',
            'magic_quotes_runtime'=>(1===get_magic_quotes_runtime())?'YES':'NO',
            );
        $this->assign('info',$info);
		$this->display('Common:welcome');
	}
}
?>